<?php
$id = session('id');
$name = session('name');
$manager = D('Manager');
$role = D('Role');
$auth = D('Auth');

if ($name==='admin') {
	$info1 = $auth->where("auth_level=1 and is_index=1 and auth_pid=101")->select();
	$this->assign('info1',$info1);

	$info2 = $auth->where("auth_level=1 and is_index=1 and auth_pid=102")->select();
	$this->assign('info2',$info2);

	$info3 = $auth->where("auth_level=1 and is_index=1 and auth_pid=103")->select();
	$this->assign('info3',$info3);

	$info4 = $auth->where("auth_level=1 and is_index=1 and auth_pid=104")->select();
	$this->assign('info4',$info4);
} else {
	//角色id
	$role_id = $manager->where('id=' . $id)->find();
	$r = $role_id['role'];
	//权限id
	$a = $role->where('role_id=' . $r)->find();
	$auth_id = $a['role_auth_ids'];

	$info1 = $auth->where("auth_id in ($auth_id) and auth_level=1 and is_index=1 and auth_pid=101")->select();
	$this->assign('info1',$info1);

	$info2 = $auth->where("auth_id in ($auth_id) and auth_level=1 and is_index=1 and auth_pid=102")->select();
	$this->assign('info2',$info2);

	$info3 = $auth->where("auth_id in ($auth_id) and auth_level=1 and is_index=1 and auth_pid=103")->select();
	$this->assign('info3',$info3);

	$info4 = $auth->where("auth_id in ($auth_id) and auth_level=1 and is_index=1 and auth_pid=104")->select();
	$this->assign('info4',$info4);
}